<template>
  <div class="newscontent">
    <h4>{{ commData.title }}</h4>
    <div class="newscontent-title">
      <span>时间: {{ commData.add_time | dataFormat}}</span>
      <span>点击: {{ commData.click }}</span>
    </div>
    <hr>
    <div class="newscontent-text">
      <div v-html="commData.content"></div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      id: this.$route.params.id,
      commData: []
    }
  },
  created () {
   this.getNewsContent()
  },
  methods: {
    getNewsContent(){
      this.$http.get(`api/getnew/${this.id}`).then(res => {
        if(res.body.status === 0){
          this.commData = res.body.message[0]
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
  .newscontent {
    h4 {
      padding: 10px 0;
    }
    padding: 0 20px;
    .newscontent-title {
      display: flex;
      justify-content: space-between;
      color: #242424;
      font-size: 14px;
    }
  }
</style>
